package com.zy.service;

import com.zy.dataobject.Item;
import com.zy.dataobject.ItemExample;
import com.zy.error.BusinessException;
import com.zy.service.model.ItemModel;

import java.util.List;

/**
 * Created by zhaoyang on 2019/6/20.
 */
public interface IItemService {
    ItemModel getItemById(Integer id) throws BusinessException;
    List<ItemModel> listItem(ItemExample itemExample);
    Integer addItem(ItemModel itemModel) throws BusinessException;
    void updateItem(ItemModel itemModel) throws BusinessException;

    /**
     * 下单减库存
     * @param itemId 商品id
     * @param amount 订单的商品数量
     * @return 操作是否成功
     */
    boolean decreaseStock(Integer itemId,Integer amount) throws BusinessException;
}
